<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page isELIgnored="false"%>
<jsp:include page="../frame/header.jsp"></jsp:include>

<title>发送系统消息</title>
</head>

<body>
	<div class="container-fluid">
		<div class="row-fluid">
			<div>
				<ul class="breadcrumb">
					<li><a href="#">消息管理</a> <span class="divider">/</span></li>
					<li><a href="#">发送消息</a></li>
				</ul>
			</div>

			<div class="box">
				<div class="box-header well" data-original-title>
					<h2>
						<i class="icon-edit"></i> 发送消息
					</h2>
					<div class="box-icon">
						<a href="#" class="btn btn-setting btn-round"><i
							class="icon-cog"></i></a> <a href="#"
							class="btn btn-minimize btn-round"><i class="icon-chevron-up"></i></a>
						<a href="#" class="btn btn-close btn-round"><i
							class="icon-remove"></i></a>
					</div>
				</div>
				<div class="box-content">
					<form id="myform" class="form-horizontal" method="post" action="<c:url value="/admin/message/message" />">
						<fieldset>
							<div class="control-group" id="sendType">
								<label class="control-label" for="sendType">发送模式</label>
								<div class="controls">
									<label class="radio inline"> <input type="radio"
										name="sendType" value="0" checked>群发
									</label> <label class="radio inline"> <input type="radio"
										name="sendType" value="1">指定用户
									</label>
								</div>
							</div>
							<div class="control-group hide" id="showUser">
								<label class="control-label" for="toUserName">用户名</label>
								<div class="controls">
									<input class="input-xlarge" id="toUserName" name="toUserName" type="text"
										 maxlength="30" check-type="required" required-message="请输入用户名" value="0">
								</div>
							</div>
							
							<div class="control-group">
								<label class="control-label" for="message">消息内容</label>
								<div class="controls">
									<textarea class="input-xlarge" id="message" name="message" rows="6" check-type="required" required-message="请输入消息内容"></textarea>
								</div>
							</div>
							
							<div class="form-actions">
								<button id="saveBtn" type="button" class="btn btn-primary">保存</button>
								<button id="cancelBtn" type="button" class="btn">返回</button>
							</div>
						</fieldset>
					</form>

				</div>
			</div>
			<!--/span-->

		</div>
	</div>
	<!--/row-->
</body>

<jsp:include page="../frame/scripts.jsp"></jsp:include>
<script type="text/javascript">
$(document).ready(function(){
	$('#cancelBtn').click(function(){
		window.location.href = '<c:url value="/admin/message/message" />';	
	})
	
	$("#myform").validation();
	
	$("input[name=sendType]").change(function(){
		var value = $(this).val();
		if(value == 0){
			$("#showUser").hide();
			$("#showUser").find("input[name=toUserName]").val(0);
		}else{
			$("#showUser").show();
			$("#showUser").find("input[name=toUserName]").val('');
		}
	});
	//保存
	$('#saveBtn').click(function(){
		$("#myform").submit();
	})
})
</script>